//
//  Macro.swift
//  SwiftBase
//
//  Created by 郭艳波 on 2018/3/10.
//  Copyright © 2018年 郭艳波. All rights reserved.
//

import UIKit
import Foundation

let theAppDelegate = UIApplication.shared.delegate

//获取屏幕 宽度、高度
let SCREEN_BOUNDS = UIScreen.main.bounds
let SCREEN_WIDTH = SCREEN_BOUNDS.width
let SCREEN_HEIGHT = SCREEN_BOUNDS.height

//不同屏幕尺寸字体适配
let XW:CGFloat =  SCREEN_WIDTH / 375.0
let YH:CGFloat = SCREEN_HEIGHT / 667.0

//通知
let NotiDefault = NotificationCenter.default

//获取APP信息
let appVersion: String = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as! String
let appName: String = Bundle.main.infoDictionary?["CFBundleDisplayName"] as! String

//获取RGB颜色
func RGBA(r:CGFloat, g:CGFloat, b:CGFloat, a:CGFloat) -> UIColor { return UIColor(red: r, green: g, blue: b, alpha: a) }
let GRandomColor = UIColor(red: CGFloat(arc4random_uniform(256)/255), green: CGFloat(arc4random_uniform(256)/255), blue: CGFloat(arc4random_uniform(256)/255), alpha: 1)

//重写NSLog,Debug模式下打印日志和当前行数
func debugLog<T>(message: T, file: String = #file, method: String = #function, line: Int = #line) {
    #if DEBUG
        print("\((file as NSString).lastPathComponent)[\(line)], \(method): \(message)")
    #endif
}
